package com.jrx.anytxn.reporting.job.unionFile.step;

import com.jrx.anytxn.reporting.config.UnionFileConfig;
import com.jrx.anytxn.reporting.constant.ReportingConstant;
import com.jrx.anytxn.reporting.service.IUnionFileService;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UnionContractFileListener implements JobExecutionListener {

    @Autowired
    private UnionFileConfig unionFileConfig;
    @Autowired
    private IUnionFileService unionFileService;

    @Override
    public void beforeJob(JobExecution jobExecution) {
        String reportingPath = unionFileConfig.getUnionFilePath();
        String fileName = unionFileConfig.getUnionFileName();
        //创建目录和空文件
        unionFileService.createDirectoriesAndFile(reportingPath,fileName, ReportingConstant.UNION_FILE_TYPE_CONTRACT_INFO);
    }

    @Override
    public void afterJob(JobExecution jobExecution) {

    }
}
